﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Rs.Common.BLL;
using Rs.Common.Enum;
using Rs.Common.Model;
using Rs.Common.WepPost;
using Rs.Common;

namespace Rs.Task
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            var interval = Convert.ToInt32(ConfigurationManager.AppSettings["TimeInterval"] ?? "600000");
            notifyIcon1.Visible = true;
            timer.Interval = interval;
            TaskBLL.StartWork();
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            TaskBLL.StartWork();
        }

        private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            notifyIcon1.Visible = false;
            Application.Exit();
        }

        private void FormMain_Activated(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormMain_FormClosed(sender, null);
        }
    }
}
